package com.example.framework509.codeGen.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.example.framework509.common.annotation.Pattern;
import com.example.framework509.common.annotation.entityAnnotations.AllowNull;
import com.example.framework509.common.annotation.entityAnnotations.VerifyMultiRepetitionField;

import java.util.Date;

@TableName("gen_field")
public class Field {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Pattern("^[a-z]\\w+$")
    @VerifyMultiRepetitionField
    private String name;

    @VerifyMultiRepetitionField
    private String dataType;

    @Pattern("^[0-1][0-1][0-1][0-1]$")
    @VerifyMultiRepetitionField
    private String annotation;

    @Pattern("^[1-9]\\d*$")
    @AllowNull
    @VerifyMultiRepetitionField
    private Integer length;

    @AllowNull
    @VerifyMultiRepetitionField
    private String defaultValue;

    @AllowNull
    private String pattern;

    @AllowNull
    private String remark;

    @TableLogic
    private Date isDeleted;

    @Version
    private Integer version;

    @Override
    public String toString() {
        return "Field{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", dataType='" + dataType + '\'' +
                ", annotation='" + annotation + '\'' +
                ", length=" + length +
                ", defaultValue='" + defaultValue + '\'' +
                ", pattern='" + pattern + '\'' +
                ", remark='" + remark + '\'' +
                ", isDeleted=" + isDeleted +
                ", version=" + version +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getAnnotation() {
        return annotation;
    }

    public void setAnnotation(String annotation) {
        this.annotation = annotation;
    }

    public String getRemark() {
        return remark;
    }

    public String getPattern() {
        return pattern;
    }

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Date isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}
